import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [{
    path: '/',
    redirect: '/movies'
  }, {
    path: '/movies',
    component: () => import('../views/Movies.vue'),
    meta: {
      title: '电影',
    },
    children: [{
      path: '',
      redirect: 'NowPlaying'
    }, {
      path: 'NowPlaying',
      component: () => import('../views/movies/NowPlaying'),
      meta: {
        title: '正在热映'
      }
    }, {
      path: 'ComingSoon',
      component: () => import('../views/movies/ComingSoon'),
      meta: {
        title: '即将上映'
      }
    }]
  }, {
    path: '/cinema',
    component: () => import('../views/Cinema.vue'),
    meta: {
      title: '影院'
    }
  },
  {
    path: '/search',
    component: () => import('../views/Search.vue'),
    meta: {
      title: '搜索'
    }
  }, {
    path: '/news',
    component: () => import('../views/News.vue'),
    meta: {
      title: '资讯'
    }
  }, {
    path: '/personal',
    component: () => import('../views/Personal.vue'),
    meta: {
      title: '我的',
      guardian: true
    }
  }, {
    path: '/detail/:id',
    component: () => import('../views/Detail.vue'),
    meta: {
      title: '详情',
      hideTabBar: true
    }
  }, {
    path: '/city',
    component: () => import('../views/City.vue'),
    meta: {
      title: '城市',
    }
  },
  {
    path: '/buy',
    component: () => import('../views/Buy.vue'),
    meta: {
      title: '购票',
    }
  },
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router